package ListTeste;

import SnmpClients.SnmpClientV2c;
import SnmpClients.SnmpClienteV3;
import java.io.IOException;
import org.snmp4j.event.ResponseEvent;
import org.snmp4j.smi.OID;

/**
 *
 * 
 */
public class ListTeste {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException, InterruptedException {

        SnmpClientV2c sc2 = new SnmpClientV2c("127.0.0.1/7001");

        SnmpClienteV3 sc3 = new SnmpClienteV3("127.0.0.1/7001", "gk", "pass1234", "pass9999");

        OID[] oid = new OID[]{new OID("1.3.6.1.2.1.1.3.0"),
            new OID("1.3.6.1.2.1.2.2.1.16.1")};


        for (int j = 0; j < 5; j++) {
            ResponseEvent re = sc3.getListAsString(oid);

            long before = re.getResponse().get(0).getVariable().toLong();
            String y = re.getResponse().get(1).getVariable().toString();
            String x = y;
            int i = 1;
            while (y.equals(x)) {
                re = sc3.getListAsString(oid);

                x = re.getResponse().get(1).getVariable().toString();
                i++;
            }

            System.out.println("Numero de ciclos: "+i);
            System.out.println("Difenreça de tempo (dezenas de ms): "+
                                (re.getResponse().get(0).getVariable().toLong() - before) +"\n");
        }

    }
}
